import React from 'react'
import { connect } from 'mirrorx'
import Title from 'component/title'
import BlockItem from './block-item'

class App extends React.Component {
  render () {
    const {initValueObj = {}, step, form, trialPrice} = this.props
    let dataList = initValueObj[1] || [{id: 1}]
    this.tempLen = dataList.length
    dataList = dataList.map((item, index) => {
      return {
        id: index + 1,
        values: item
      }
    })

    const Lang = window.LangMessage || {}
    return (
      <div>
        <Title title={Lang.holder_info || '投保人信息'} step={step} />

        <div className='section-content'>
          <div className='mb20'>
            {dataList.map((item, index) => {
              return <div key={index}>
                <BlockItem
                  dataList={dataList}
                  blockItem={item}
                  step={step}
                  form={form}
                  trialPrice={trialPrice}
                  type={1}
                  itemIndex={index}
                />
              </div>
            })}
          </div>
        </div>
      </div>
    )
  }
}

export default connect(state => {
  return {
    initValueObj: state.insureModel.initValueObj,
    blocksMap: state.insureModel.blocksMap
  }
})(App)
